Skip to content

Conversation

@Ceng23333
Copy link
Collaborator

@Ceng23333 Ceng23333 commented Nov 20, 2025

#634
测例编译
xmake build infinicore-test

image

测例执行
INFINICORE_LOG_LEVEL=info build/linux/x86_64/release/infinicore-test --nvidia --test all

image

Signed-off-by: Ceng23333 <[email protected]>
Signed-off-by: Ceng23333 <[email protected]>
Signed-off-by: Ceng23333 <[email protected]>
Runtime *getCpuRuntime();

// Get runtime for a specific device (creates it if it doesn't exist)
Runtime *getRuntime(Device device);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个接口有哪里用过吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个之前调试加的接口,后面没用了

* @brief RoPE algorithm type
* @brief Frequency generation method for RoPE cache
*/
enum class FreqGen {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥要有这个呢?都用Algo行不行?

RoPE(size_t head_dim,
size_t max_seq_len,
double theta = 10000.0,
Algo freq_gen = Algo::GPT_J,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

所以这个地方又是为什么要两个呢?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rope如果有问题的话需要解决一下

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

问了gpt,hf确实是这样算的

Signed-off-by: Ceng23333 <[email protected]>

target("infinicore_c_api")
set_kind("phony")
set_kind("shared")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

单独拆出来一个cpp api

std::unique_ptr<MemoryAllocator> device_memory_allocator_;
std::unique_ptr<MemoryAllocator> pinned_host_memory_allocator_;
// Mutex to protect stream access for thread safety
mutable std::mutex stream_mutex_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要这个锁

if (pinned_host_memory_allocator_) {
pinned_host_memory_allocator_.reset();
// Wrap entire destructor in try-catch to prevent exceptions from causing segfaults
try {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

写的太复杂

}

void Runtime::memcpyD2H(void *dst, const void *src, size_t size) {
SPDLOG_DEBUG("[RUNTIME] memcpyD2H: Called with runtime device: {}", device_.toString());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没必要做这么多检查

}
if (this->device().getType() == src->device().getType()) {
op::rearrange_(Tensor(const_cast<TensorImpl *>(this)->shared_from_this()), src);
if (this->device().getType() == src->device().getType() && this->device().getIndex() == src->device().getIndex()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

检查太多了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants